package day13;

import java.util.concurrent.TimeUnit;

public class InterruptedDemo {

    public static void main(String[] args) {

        System.out.println("Main thread is interrupted？" + Thread.interrupted());

        Thread.currentThread().interrupt();

        System.out.println("Main thread is interrupted？" + Thread.currentThread().isInterrupted());

        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (Exception e) {
            System.out.println("I will be interrupted still.");
        }

    }

}
